from pyhanlp import *


if __name__ == "__main__":
    CORPUS = "all.txt"
    MODEL = "model.bin"
    NERTrainer = JClass("com.hankcs.hanlp.model.perceptron.NERTrainer")

    # 构建训练器
    trainer = NERTrainer()
    # 通过下载的语料训练模型，保存到model.bin
    trainer.train(CORPUS, MODEL)
